<?php if (hasPermission("namespaces.object.create.discussion")): ?>
	<?php $this->append ("scripts", "forumtag") ?>
	
	<form action="<?php echo Gene::makeLink($object) ?>/new/discussion" method="post">
	
	<fieldset>
	<legend>Create Discussion</legend>
	
	<?php if ($draft): ?>
		<input type="hidden" name="draftid" value="<?php echo $draft['draft_id'] ?>" />
	<?php endif; ?>
	
	<?php if (!$loggedin): ?>
		<?php $this->display ("objects/guest") ?>
	<?php endif; ?>
	
	<p class="fieldlabel"><label for="topictitle">Discussion Title:</label></p>
	<p class="field"><input type="text" id="topictitle" name="objtitle" class="required" size="32" value="<?php _e($title) ?>" /></p>
	
	<p class="fieldlabel"><label for="topicdescription">Discussion Description: <em>(Optional)</em></label></p>
	<p class="field"><input type="text" id="topicdescription" name="objdesc" size="64" value="<?php _e($description) ?>" /></p>
	
	<p class="fieldlabel"><label for="formobjcontent">Message:</label></p>
	<p class="field"><?php $this->display('objects/enhancedinput', array('rows' => 12, 'required' => true)) ?></p>
	
	<div id="tageditor">
	
	<p class="fieldlabel"><label for="tags">Tags:</label></p>
	<p class="field"><input type="text" id="tags" name="tags" autocomplete="off" size="48"
	<?php if (isset($options['tags'])): ?>
		value="<?php echo implode(' ', $options['tags']) ?>"
	<?php elseif ($showingtag): ?>
		value="<?php _e($showingtag) ?>"
	<?php endif; ?>
	 /></p>
	<p class="field" id="tagssuggest">Separate tags with spaces.</p>
	
	<?php if (count($usertags)): ?>
		<p class="fieldlabel">My Tags:</p>
		<p id="usersuggest" class="field"><?php $this->display('objects/discussion/addtags', array('terms' => $usertags, 'type' => 'user')) ?></p>
	<?php endif; ?>
	
	<?php if (count($globaltags)): ?>
		<p class="fieldlabel">Popular Tags:</p>
		<p id="globalsuggest" class="field"><?php $this->display('objects/discussion/addtags', array('terms' => $globaltags, 'type' => 'global')) ?></p>
	<?php endif; ?>
	
	</div>
	
	<p class="formcontrols">
	<input type="submit" value="Create New Discussion" class="btn_focus" />
	
	<?php if ($draft || getUserProperty('drafts') < Gene::getSetting('maximum_drafts')): ?>
		<input type="submit" name="draft" value="Save Draft" class="btn_minor skipcheck" />
	<?php endif; ?>
	</p>
	
	</fieldset>
	
	</form>
<?php endif; ?>